package net.shao.activity;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

import net.shao.R;
import net.shao.base.BaseActivity;
import net.shao.widget.HeadBar;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import cn.jpush.android.api.JPushInterface;

/**
 * 如果密码为88888888
 */
public class MainActivity extends BaseActivity {

    @ViewInject(R.id.mainTitle)
    private HeadBar title;
    @ViewInject(R.id.btn_baiduMap)
    private Button btn_baiDuMap;
    @ViewInject(R.id.btn_share)
    private Button btn_share;
    @ViewInject(R.id.btn_jpush)
    private Button btn_Jpush;
    @ViewInject(R.id.btn_tabMenu)
    private Button btn_tabMenu;
    @ViewInject(R.id.btn_tabChat)
    private Button btn_chat;
    @ViewInject(R.id.btn_recycler)
    private Button btn_recycler;

    private MainOnClickListener mainOnClickListener = new MainOnClickListener();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        x.view().inject(this);
        title.setTitle("主页");

        btn_baiDuMap.setOnClickListener(mainOnClickListener);
        btn_share.setOnClickListener(mainOnClickListener);
        btn_Jpush.setOnClickListener(mainOnClickListener);
        btn_tabMenu.setOnClickListener(mainOnClickListener);
        btn_chat.setOnClickListener(mainOnClickListener);
        btn_recycler.setOnClickListener(mainOnClickListener);
    }


    private class MainOnClickListener implements View.OnClickListener {

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.btn_baiduMap:
                    toActivity(BaiduMapActivity.class);
                    break;
                case R.id.btn_share:
                    toActivity(ShareActivity.class);
                    break;
                case R.id.btn_jpush:
                    toActivity(JpushActivity.class);
                    break;
                case R.id.btn_tabMenu:

                    break;
                case R.id.btn_tabChat:
                    toActivity(LoginActivity.class);
                    break;
                case R.id.btn_recycler:
                    toActivity(RecyclerActivity.class);
                    break;
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        JPushInterface.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        JPushInterface.onPause(this);
    }
}
